package com.itheima.service.severlimpl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.common.PageBean;
import com.itheima.domain.pojo.TCheckItem;
import com.itheima.mapper.YCheckItemMapper;
import com.itheima.service.YCheckItemSeverl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class YCheckItemSeverlimpl implements YCheckItemSeverl {

    @Autowired
    private YCheckItemMapper yCheckItemMapper;

    @Override
    public PageBean selectAll(Integer page, Integer size, String name) {
        PageHelper.startPage(page, size);
        Page<TCheckItem> page1 = yCheckItemMapper.selectAll(page,size,name);
        return new PageBean(page1.getTotal(),page1.getResult());
    }

    @Override
    public void add(TCheckItem tCheckItem) {
        yCheckItemMapper.insert(tCheckItem );
    }

    @Override
    public TCheckItem selectById(Integer id) {
        TCheckItem tCheckItem = yCheckItemMapper.selectById(id);
         return tCheckItem;
    }

    @Override
    public void update(TCheckItem tCheckItem) {
        yCheckItemMapper.update(tCheckItem);
    }

    @Override
    public void delete(Integer id) {
        yCheckItemMapper.delete(id);
    }
}
